﻿using Basic.HrRemoteModel.Msg;
using Basic.HrRemoteModel.Msg.Model;
using Basic.HrService.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Basic.HrService.RpcEvent
{
    internal class MsgEvent : IRpcApiService
    {
        private readonly IEmpMsgService _Service;

        public MsgEvent ( IEmpMsgService service )
        {
            this._Service = service;
        }
        public Dictionary<string, int> GetUserMsgTotal ( GetUserMsgTotal arg )
        {
            return this._Service.GetTotal(arg.GetArg);
        }
        public void AddMsg ( AddMsg add )
        {
            this._Service.Adds(add.Datum);
        }
        public void BatchToVoidMsg ( BatchToVoidMsg obj )
        {
            this._Service.ToVoid(obj.Items);
        }
        public void MsgBatchOpt ( MsgBatchOpt obj )
        {
            this._Service.BatchOpt(obj.Adds, obj.ToVoid, obj.Done);
        }
        public void SetMsgDone ( SetMsgDone obj )
        {
            this._Service.SetDone(obj.LinkType, obj.LinkPk, obj.Tag);
        }
        public void ToVoidMsg ( ToVoidMsg obj )
        {
            this._Service.ToVoid(obj.LinkType, obj.LinkPk, obj.Tag);
        }
        public PagingResult<MsgDatum> QueryMsg ( QueryMsg obj )
        {
            return this._Service.Query(obj.Query, obj.ToBasicPage());
        }

        public void SetMsgRead ( SetMsgRead obj )
        {
            this._Service.SetAlreadyRead(obj.Id);
        }

        public void SetBatchRead ( SetBatchRead obj )
        {
            this._Service.SetAlreadyRead(obj.Ids);
        }
    }
}
